package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-05-23
 * Time: 20:10
 */
public class BookList {
    private Book[] books = new Book[100];//存放图书
    private int usedSize;//实际图书数目

    public BookList() {
        //书架中原本就有着三本书，在构造方法中完成初始化
        books[0] = new Book("三国演义","罗贯中",50,"小说");
        books[1] = new Book("朝花夕拾","鲁迅",25,"散文");
        books[2] = new Book("悲惨世界","雨果",30,"小说");
        this.usedSize = 3;
    }

    public Book[] getBooks() {//得到Book数组
        return books;
    }

    public void setBook(int pos,Book book) {//通过下标来设置某本书
        this.books[pos] = book;
    }
    public Book getBook(int pos) {//通过下标来得到某本书
        return this.books[pos];
    }

    public int getUsedSize() {//得到图书的实际数目
        return usedSize;
    }

    public void setUsedSize(int usedSize) {//设置图书的实际数目
        this.usedSize = usedSize;
    }
}
